# koroFileHeader at Yungoal acer
# Create: 2021-08-26 17:32:45
# LastEdit: 2021-08-26 17:58:53
"""35. 搜索插入位置
https://leetcode-cn.com/problems/search-insert-position/
"""
__author__ = '749B'

import bisect

from typing import List

class Solution:
    def searchInsert(self, nums: List[int], target: int) -> int:
        if target not in nums:
            nums.append(target)
            nums.sort()
        return nums.index(target)

    def searchInsert2(self, nums: List[int], target: int) -> int:
        return bisect.bisect_left(nums, target)

        